<?PHP 
function yuyueStatus($status = ''){
    $array  =   array('','<font class="text-success">新预约</font>','<font class="text-info">已出发</font>','已完成','已取消');
    if( $status !== '' ){
        return $array[$status];
    }else{
        return $array;
    }
}

function get_shop_type($id){
	
	if($id==0){
		$store_type_info[0]['label']="无分组";
	}else{
		$store_type=M('store_type');
        $map['id']=array('in',$id);
		$store_type_info=$store_type->where($map)->select();
	}
	return $store_type_info;
	
}

	//获取订单商品
	function get_order_shop($order_id){
		$order_goods=M('order_goods');
		$order_goods_list=$order_goods->where('order_id='.$order_id)->select();
		return $order_goods_list;
	}
	
	function get_count_daiyan($uid,$store){
		$order_goods=M('order_goods');
		$tj_list=$order_goods->where("recommend_id=$uid and store_id=$store")->count();
		
		return $tj_list;
	}
	function get_count_daiyan_prcie($uid,$store){
		$order_goods=M('order_goods');
		$tj_list_price=$order_goods
			->join('yt_order on yt_order.order_id=yt_order_goods.order_id')
			->where("yt_order_goods.recommend_id=$uid and yt_order_goods.store_id=$store and yt_order.lock_state=1")->sum('yt_order_goods.recommend_price');
		IF(!$tj_list_price){
			$tj_list_price='0.00';
		}
		return $tj_list_price;
	}
	
	function get_count_succse_daiyan($uid,$store){
		$order_goods=M('order_goods');
		$tj_list_price=$order_goods
			->join('yt_order on yt_order.order_id=yt_order_goods.order_id')
			->where("yt_order_goods.recommend_id=$uid and yt_order_goods.store_id=$store and yt_order.lock_state=1")->count();
		
		return $tj_list_price;
	}
	function get_count_daiyan_dr_prcie($uid,$store){
		$order_goods=M('order_goods');
		$tj_list_price=$order_goods
			->join('yt_order on yt_order.order_id=yt_order_goods.order_id')
			->where("yt_order_goods.recommend_id=$uid and yt_order_goods.store_id=$store and yt_order.lock_state=0 and  yt_order.order_state>='20' and yt_order.refund_state=0")
			->sum('yt_order_goods.recommend_price');
		
		return $tj_list_price;
	}
	function get_web_invoice(){
		$web_qita = F("web_qita");
		if(empty($web_qita)){
			$options_obj = M("Options");
			$option = $options_obj->where("option_name='web_qita'")->find();
	
			if($option){
				$web_qita = json_decode($option['option_value'],true);
			}else{
				$web_qita = array();
			}
			F("web_qita", $web_qita);
		}
		return $web_qita;	
	}

?>